package huaweiExam;

import java.util.Scanner;

public class Test1_2 {
    //4 1 3 5 2
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String inut = sc.nextLine();
        String[] strnums = inut.split(" ");
        int[] nums = new int[strnums.length];
        if (nums.length == 0) {
            System.out.println("[]");
            return;
        }
        try {
            for (int i = 0; i < nums.length; i++) {
                nums[i] = Integer.parseInt(strnums[i].trim());
            }
            getRes(nums);
        } catch (Exception e) {
            System.out.println("[]");
            return;
        }

        for (int i = 0; i < nums.length; i++) {
            if (i < nums.length - 1) {
                System.out.print(nums[i] + " ");
            } else {
                System.out.print(nums[i]);
            }
        }

    }

    public static void getRes(int[] nums) {

        for (int i = 1; i < nums.length; i++) {
            if (i % 2 == 1 && nums[i] > nums[i - 1]) {
                int temp = nums[i];
                nums[i] = nums[i - 1];
                nums[i - 1] = temp;

            }
            if (i % 2 == 0 && nums[i] < nums[i - 1]) {
                int temp = nums[i];
                nums[i] = nums[i - 1];
                nums[i - 1] = temp;
            }


        }
    }
}
